<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 如果1 显示优秀，如果是2 显示良好，3 显示差劲
      //效果如下 打印页面
      // 张三 优秀
      // 李四 差劲
      // 王五 良好
      let obj = [
        { uname: '张三', score: 90, status: '1' },
        { uname: '李四', score: 10, status: '3' },
        { uname: '王五', score: 70, status: '2' },
      ]
      let newobj = {
        1: '优秀',
        2: '良好',
        3: '差劲',
      }

      obj.forEach((x) => {
        x.status = newobj[x.status]
      })

      const arr = { 姓名: 'zs', 性别: '男' }
      const rule = {
        姓名: 'name',
        性别: 'gender',
      }
      //  // // =>结合arr和rule数据处理成 提示for in// {name:'zs',gender:'男'}
      let newarr = {}
      for (let k in arr) {
        newarr[rule[k]] = arr[k]
      }
      console.log(newarr)
      // ['1','3','5','3','5','3','8','9'] //统计次数 次数最大的次数是谁
      let a = ['1', '3', '5', '3', '3','3','5', '3', '8', '9']
      let b = []
      let c = {}
  a.forEach(x=>{
    if(b.indexOf(x)===-1){
      b.push(x)
      c[x]=1
    }else {
      c[x]++
    }
  })
  let d= []
  let e =0
  for(let k in c){
    if(e<c[k]){
      e=c[k]
      d.push(k)
    }
  }
  console.log(e,d[1]);
    </script>
  </body>
</html>
